package it.evento.utils.genpage;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author Mark
 */
public class Comment {
    private String user;
    private String content;
    private Date date;
    
    public Comment(){
        resetAll();
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }
   
     public String print() {
        SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy HH:mm");
        String ret = "";
        
        ret += "<div class='evento-comment'>" ;
            ret += "<div class='evento-comment-avatar'>";
                      ret +="<img src='images/no-avatar.jpg' width='80' height='80'/>";
            ret +="</div>";
            if(!this.user.equals("")) {
                ret += "<div class='evento-comment-content'>";
                    ret += " <div class='evento-comment-header'><h3>" + this.user + "</h3>"+DATE_FORMAT.format(this.date)+"</div>";
                    if(!this.content.equals("")) {
                        ret+="<div class='evento-comment-inner'>";
                            ret+=this.content;
                        ret+="</div>";
                    }
                ret+="</div>";   
            }                   
               
        ret+="</div>";

        resetAll();
        
        return ret;
    }
    
     private void resetAll() {
        this.user = "";
        this.content = "";

    }
}
